-
-
Notifications
You must be signed in to change notification settings - Fork 533
Minor bug fixes and docs improvements #873
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Since
data-tooltip-content
was never intended to renderhtml
stuff, removed it from relevant sections. -
The "Content" example page is redundant, since it became exactly the "Basic examples" page.
I wrote the |
Everything else, I totally agree |
if (html) { | ||
// html will take precedence | ||
setIsHtmlContent(true) | ||
setTooltipContent(html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have the feeling that we will spend resources (a bit) doing the:
setIsHtmlContent(false)
and after that:
setIsHtmlContent(true)
In this case, I prefer not to do the setIsHtmlContent(false)
if we will do setIsHtmlContent(true)
two lines below.
Is this necessary in this order? or can we add a validation to do one or other?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The validation would only serve to make the code clearer (which I think is unnecessary, since it's simple enough).
React 18 batches useState()
updates, so the state is effectively only updated once. This source is a bit outdated, but I'm pretty sure that still holds true.
We can come back to this in the future if we ever decide to improve the content
/html
props (maybe there shouldn't be a single state variable - tooltipContent
- that holds the value for the one being actually used).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, interesting!
ok
Closes #872
Closes #875
After agreeing on these the PR should be ready to review.
State/Uncontrolled tooltip state section
Should we remove this section? It just shows a limitation of the component (which could be fixed, but why?), and the use case in the example can be much more conveniently achieved by using the recently added provider.
Click event
Since the recent design change (when clicking an open tooltip with
click
event enabled, it no longer closes the tooltip), does it even make sense to use bothhover
andclick
event simultaneously? Maybe we should remove the last section.Further considerations (slightly related to PR)
I propose a breaking API change (maybe initially just deprecate
events
instead of fully removing it) similar to how V4seffect: 'solid' | 'float'
prop got replaced by just thefloat: boolean
prop.A
click: boolean
prop would replace theevents
prop to activate the "on click" mode.